home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / platforms and tools / installer / lockfile / setlockbitatomsample.r < prev   
Encoding:
Text File  |  2000-06-23  |  5.6 KB  |  160 lines

  1. /*
  2.     File:        SetLockBitAtomSample.r
  3.  
  4.     Contains:    Install application "TheProgram" into the "Root directory and lock the file.
  5.                 For this sample, I use TeachText as the program to install and lock.
  6.                 Demonstrates implementation of an action atom.
  7.                 
  8.                 You can build the script with the following lines:
  9.  
  10.                 rez  -o "SetLockBitAtomSample" -t 'bjbc' -c 'bjbc' "SetLockBitAtomSample.r"
  11.                 setfile -a i "SetLockBitAtomSample"
  12.                 scriptcheck -p "SetLockBitAtomSample"
  13.     
  14.     Written by: Rich Kubota    
  15.  
  16.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  17.  
  18.                 You may incorporate this Apple sample source code into your program(s) without
  19.                 restriction. This Apple sample source code has been provided "AS IS" and the
  20.                 responsibility for its operation is yours. You are not permitted to redistribute
  21.                 this Apple sample source code as "Apple sample source code" after having made
  22.                 changes. If you're going to re-distribute the source, we require that you make
  23.                 it clear in the source that the code was descended from Apple sample source
  24.                 code, but that you've made changes.
  25.  
  26.     Change History (most recent first):
  27.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  28.                 
  29.  
  30. */
  31.  
  32. #include "Types.r"
  33. #include "InstallerTypes.r"
  34.  
  35. /* 'inaa' code resource definition */
  36. #define        aaCodeID            10000
  37.  
  38. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  39. #define kScriptCheckSetsDate    0x01
  40.  
  41. /* Definitions for the file spec atoms (specifications for source and destination files) */
  42. #define fsSourceProgram            2000
  43. #define fsTargetProgram            2001
  44.  
  45. /* This is the name of the source disk */
  46. #define ProgramDisk "Program Disk:"
  47.  
  48. /* where we want to install our file. */
  49. #define TargetPath    ":"
  50.  
  51. /* Definition for the package. */
  52. #define pkTheProgram            3000
  53.  
  54. /* Definition for the file atom */
  55. #define faProgram                4000
  56.  
  57. /* Definition for the package comment resource */
  58. #define cmtTheProgram            5000
  59.  
  60. /* Definitions for the action atom resources */
  61. #define aaSetLockBit            6000
  62.  
  63. /* June 16, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  64. /* this value to a LongInt seconds value needed by the Installer. */
  65. #define currentReleaseDate        6161992        
  66. #define currentVersion            100     /* Version 1.0 goes in the 'icmt' rsrc */
  67.  
  68. #define iconTheProgram            5100
  69.  
  70. /************************** Easy Install Rule resources **********************************/
  71.  
  72. /***************************** Package Resources ************************************************/
  73. resource 'inpk' (pkTheProgram) {
  74.     format0 {
  75.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  76.         Removable,                    /* Package can be removed */
  77.         dontForceRestart,            /* no need to restart */
  78.         cmtTheProgram,                 /* package's 'icmt' resource id */
  79.         0,                            /* Package size (filled in by ScriptCheck) */
  80.         "TheProgram", {                /* package name for package that shows on custom */
  81.             'infa', faProgram;
  82.             'inaa', aaSetLockBit;
  83.         }
  84.     }
  85. };
  86.  
  87. /***************************** Comments ************************************************/
  88. resource 'icmt' (cmtTheProgram) {
  89.     currentReleaseDate,
  90.     currentVersion,
  91.     iconTheProgram,
  92.     "This package contains TheProgram. "
  93. };
  94.  
  95. resource 'ICON' (iconTheProgram) {
  96.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  97.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  98.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  99.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  100.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  101.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  102.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  103.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  104. };
  105.  
  106.  
  107. /********************************************* File Specs ******************************************/
  108. /* Source File Specs */
  109. resource 'infs' (fsSourceProgram) {
  110.     'APPL',                                /* File Type */
  111.     'ttxt',                                /* Creator */
  112.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  113.     noSearchForFile,                    /* Do not search the source disk for the file */
  114.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  115.     ProgramDisk"TeachText"                /* Path to the file */
  116. };
  117.  
  118. /* Target File Specs */
  119. resource 'infs' (fsTargetProgram) {
  120.     'APPL',                                /* File Type */
  121.     'ttxt',                                /* Creator */
  122.     0,                                    /* creation date not needed for target file specs */
  123.     noSearchForFile,                    /* Do not search the target disk for the file */
  124.     TypeCrMustMatch,                    /* not needed for target file specs */
  125.     TargetPath"TeachText"                /* destination Path */
  126. };
  127.  
  128. /******************************************** File Atoms ************************************************/
  129. resource 'infa' (faProgram) {
  130.     format0 {
  131.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  132.         delInstall,                     /* Delete the target before copying new one */
  133.         copy,                             /* Copy the file to the destination */
  134.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  135.         noKeepExisting,                 /* Always replace an existing copy */
  136.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  137.         rsrcFork, dataFork,                /* Copy both forks of the file */
  138.         fsTargetProgram,                /* TARGET file spec for this file */
  139.         fsSourceProgram,                 /* SOURCE file spec for this file */
  140.         0,                                /* atom size (filled in by ScriptCheck) */
  141.         ""                                /* Atom Description (Installer will use file name) */
  142.     };
  143. };
  144.  
  145.  
  146. resource 'inaa'    (aaSetLockBit) {
  147.     format0 {
  148.         actAfter,
  149.         dontActOnRemove,
  150.         actOnInstall,
  151.         'infn',
  152.         aaCodeID,
  153.         fsTargetProgram,                /* pass in the 'infs' resource ID of the file to lock */
  154.         "Set Locked Bit of Target file based on target infs resource ID"
  155.     }
  156. };
  157.  
  158. INCLUDE    "SetLockBit.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  159.  
  160.